<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>YUI Namespace Tests</title>
</head>

<body class="yui3-skin-sam">

<h1>Namespace Tests</h1>
<p><input type="button" value="Run Tests" id="btnRun" disabled="true" /></p>

<script type="text/javascript" src="../../../build/yui/yui.js"></script>
<script type="text/javascript">

(function() {
    YUI({
        filter: "debug",
        logExclude: {Dom: true, Selector: true, Node: true, attribute: true, base: true, event: true, widget: true}
    }).use("dump", "test", "console", "event-custom", function(Y) {

        var button = Y.one('#btnRun'),
            Assert = Y.Assert;

        // Set up the page
        button.set("disabled", false);
        Y.on("click", function() {
            Y.Test.Runner.run();
        }, button);

        var myConsole = new Y.Console().render();

        var testNamespace = new Y.Test.Case({
            name: "Namespace tests",


        test_create_namespace: function () {

            // set up Y.my.namespace
            var ns = Y.namespace("my.namespace");

            // use the returned reference, assign a value
            ns.test = "yahoo_my_namespace_test";

            // check for the assigned value using the full path
            Assert.areEqual(Y.my.namespace.test, "yahoo_my_namespace_test", "The namespace was not set up correctly");

            // assign a value to my to test that it doesn't get wiped out
            Y.my.test = "yahoo_my_test";

            // create another namespace on my
            var ns2 = Y.namespace("my.namespace2");

            // make sure my stays the same
            Assert.areEqual(Y.my.test, "yahoo_my_test", "The namespace was obliterated");
        } 

    });
        

        Y.Test.Runner.add(testNamespace);
        Y.Test.Runner.run();
    });
})();
</script>
</body>
</html>
